package calbs.socket.packaging;

import calbs.socket.pojo.resp.RespBaseMsg;
import calbs.socket.pojo.resp.RespData;
import calbs.socket.pojo.resp.RespLoginAcceptMsg;
import calbs.socket.tool.CHexConver;

/**
 * Created by Q on 2017/8/10.
 */
public class LoginAcceptPackagingImp implements PackagingI<RespLoginAcceptMsg> {
    @Override
    public String analysisMsg(RespData<RespLoginAcceptMsg> respData) {
        RespLoginAcceptMsg respLoginAcceptMsg = respData.getBody();
        int utcTime = respLoginAcceptMsg.getUtcTime();
        String content  = CHexConver.integeroHexString(utcTime,4);
        String userName = respLoginAcceptMsg.getUserName();
        String password = respLoginAcceptMsg.getUserPassword();
        String loginMsg = "username:"+userName+","+"password:"+password;
        content = content+CHexConver.packagingStr(loginMsg);
        return PackingUtils.packing(respData.getBody(),content);
    }
}
